import ui from "../dxmodules/dxUi.js";
import std from "../dxmodules/dxStd.js"

// UI context
let context = {}

// UI initialization
ui.init({ orientation: 1 }, context);

// Create screen
let mainView = ui.View.build('mainView', ui.Utils.LAYER.MAIN)

// Create a text control
let label = ui.Label.build(mainView.id + 'label', mainView)
// Set text content
label.text("22 April 2020 15:36")
// Set text color
label.textColor(0x000000)
// Create fonts
let font24 = ui.Font.build('/app/code/resource/font/AlibabaPuHuiTi-2-65-Medium.ttf', 24, ui.Utils.FONT_STYLE.NORMAL)
// Set text font
label.textFont(font24)

// Loading screen
ui.loadMain(mainView)

// Refresh UI
let timer = std.setInterval(() => {
    if (ui.handler() < 0) {
        std.clearInterval(timer)
    }
}, 1)

